import React, { Component } from 'react';
import DemoC from './Child';
class DemoP extends Component {
  state = { 
    price: 10
  } 
  updatePrice = (price)=> {
   this.setState({
     price
   })
  }
  render() { 
      return (<div>
        <h3>7.2. 子组件给父子组件传值</h3>
         <p>父组件</p>
         当前榴莲价格为：{this.state.price}
         <DemoC updatePrice={this.updatePrice} price={this.state.price} />
      </div>);
  }
}
 
export default DemoP;